<%= javascript_include_tag 'admin.js' %>
<%= stylesheet_link_tag 'admin.css' %>
<%= render 'user_information/admin_head' %>

<div class="search_iframe">
  <label>登录号</label>
  <input type="text" id="search_val" />
  <button onclick="search_note('/note_info/index')">搜索</button>
</div>

<table>
  <thead>
  <tr>
    <th>id</th>
    <th>登录号</th>
    <th>内容</th>
    <th>赞数</th>
    <th>图片</th>
    <th>创建时间</th>
    <th>修改时间</th>
    <th>操作</th>
  </tr>
  </thead>
  <% @get_note.each do |note| %>
      <tbody>
      <tr>
        <td><%= note.id %></td>
        <td style="width: 100px"><%= note.user_id %></td>
        <td style="width: 300px;"><%= note.content %></td>
        <td><%= note.laud_num %></td>
        <td style="width:200px"><a onclick="show_photo(<%= note.id %>)"><%= note.note_photo.to_s.slice(0,20) + '...'%></a></td>
        <td><%= note.created_at.to_s.slice(0,10) %></td>
        <td><%= note.updated_at.to_s.slice(0,10) %></td>
        <td><a id="delete_user"  onclick="delete_user(<%= note.id %>)">删除</a> </td>
      </tr>
      </tbody>

      <div id="edit_note<%= note.id %>" class="edit_note" >
        <div class="edit_note_fram">
          <div style="margin: 20px 10px;line-height: 60px;height: 60px;text-align: center;">
            <span>确定删除帖子吗？</span>
          </div>
          <button onclick="confirm_delete_note(<%= note.id %>)">确定</button>
          <button onclick="cancel(<%= note.id %>)">取消</button>
        </div>
      </div>

      <div id="edit_note_image<%= note.id %>" class="edit_note" ondblclick="hide_photo(<%= note.id %>)">
        <div class="image_show" >
          <img src="<%= note.note_photo %>" />
        </div>
      </div>
  <% end %>
</table>
<table id="page">
  <tr>
    <td><a href="/note_info/index?page=1" style="color: <%= @current_page.to_i == 1 ? "#141315" : '#98bf21'%>">首页</a></td>
    <td><a href="/note_info/index?page=<%= @current_page.to_i >1 ? (@current_page.to_i) - 1 : @current_page.to_i %>" style="color: <%= @current_page.to_i == 1 ? "#141315" : '#98bf21'%>" >上一页</a></td>
    <td>第<input id="jump_page" type="text"  value="<%= @current_page %>" onblur="page_jump(<%= @total_page %>,'/note_info/index')"/>页</td>
    <td><span>共</span></td>
    <td><%= @total_page %></td>
    <td><a href="/note_info/index?page=<%= @current_page.to_i < @total_page ? (@current_page.to_i) + 1 : @current_page.to_i %>" style="color: <%= @current_page.to_i == @total_page ? "#141315" : '#98bf21'%>" >下一页</a></td>
    <td><a href="/note_info/index?page=<%= @total_page %>" style="color: <%= @current_page.to_i == @total_page ? "#141315" : '#98bf21'%>">尾页</a></td>
  </tr>
</table>